Skip to main content

Amazon DocumentDB

1. Introduction

Amazon DocumentDB (with MongoDB compatibility) is a fully managed, cloud-native document database service designed to run MongoDB workloads. It allows you to use your existing MongoDB drivers, tools, and application code with minimal changes while taking advantage of the benefits of a managed service. This means you can focus on building your applications rather than on database administration tasks such as hardware provisioning, patching, backups, and scaling.

2. Architecture and Key Features

2.1. Cloud-Native, Managed Service

  • Fully Managed: AWS handles infrastructure management, security patches, backups, and high availability.
  • MongoDB Compatibility: Designed to work with MongoDB APIs (versions 3.6 and 4.0—with emerging support for 5.0 features), enabling seamless migration from self-managed MongoDB databases.

2.2. Decoupled Compute and Storage

  • Separation of Concerns: Compute instances (primary and up to 15 replicas) are decoupled from the storage layer, which automatically scales as your data grows.
  • Automatic Storage Scaling: The storage volume automatically increases in increments (typically 10‑GB segments) up to petabyte-scale without manual intervention.

2.3. High Availability and Durability

  • Data Replication: Data is automatically replicated six ways across three Availability Zones within a region. This design provides strong durability and fault tolerance.
  • Automatic Failover: In case of instance failure, the system automatically promotes a replica to primary (often within 30 seconds) without data loss.
  • Crash Recovery: Engineered for near-instant recovery by avoiding redo log replay during restarts.

2.4. Performance and Scalability

  • Optimized Storage Engine: Uses an SSD-backed, log-structured storage engine to handle millions of requests per second with low latency.
  • Read Scaling: You can add up to 15 replicas to scale out read operations; a dedicated reader endpoint helps distribute the read load.
  • Vertical and Horizontal Scaling: Easily change instance sizes or add replicas as your workload grows.

2.5. Backup and Recovery

  • Continuous Backups: Automatic, incremental, and continuous backups are stored in Amazon S3 with high durability (designed for 99.999999999% durability).
  • Point-in-Time Recovery: Restore your cluster to any point within your configured backup retention period (up to 35 days) with minimal downtime.

3. Connectivity and Endpoints

Amazon DocumentDB supports multiple connection methods to suit different use cases:

  • Cluster Endpoint: Connects to the current primary instance for read/write operations and automatically handles failover.
  • Reader Endpoint: Load-balances read requests across all replicas, simplifying scaling for read-intensive workloads.
  • Instance Endpoint: Allows direct connection to a specific instance, useful for specialized scenarios such as running analytical queries.

When connecting in replica set mode, your client sees the cluster as a single replica set, which facilitates automatic failover and load balancing.

4. Management and Monitoring

4.1. Administration

  • AWS Management Console, CLI, and SDKs: Manage your clusters, configure instances, and perform scaling operations via multiple interfaces.
  • Automated Operations: Tasks such as patching, backups, and instance restarts are handled automatically, reducing administrative overhead.

4.2. Monitoring

  • CloudWatch Integration: Monitor performance metrics such as CPU, memory, I/O operations, and network throughput.
  • Event Notifications: Set up subscriptions to be alerted on critical events like failovers or maintenance activities.

5. Security and Compliance

Amazon DocumentDB comes with strong security features by default:

  • VPC-Only Access: Runs exclusively within your Amazon Virtual Private Cloud (VPC) for network isolation.
  • Encryption: Supports TLS for data in transit and AES-256 encryption for data at rest; encryption keys can be managed via AWS KMS.
  • AWS IAM Integration: Fine-grained access control is provided through AWS Identity and Access Management (IAM) along with resource tagging.
  • Auditing and Compliance: Supports auditing of database activity, and complies with major standards (such as PCI DSS, ISO 27001, SOC 1/2/3, and is HIPAA eligible).

6. Migration Strategies

For organizations moving from on-premises or self-managed MongoDB deployments, Amazon DocumentDB offers several migration approaches:

  • Offline Migration: Using tools like mongodump and mongorestore for scenarios where downtime is acceptable.
  • Online Migration: Leverage AWS Database Migration Service (DMS) for near-zero downtime migrations by continuously syncing changes from your source database.
  • Hybrid Approach: Combines both offline and online methods to minimize downtime while efficiently migrating large data sets.

7. Pricing

Amazon DocumentDB pricing is based on several factors:

  • Instance Hours: Billed per second based on the instance type.
  • I/O Operations: Measured per million I/O requests.
  • Backup Storage: Charged per GiB per month for automated backups and snapshots.
  • Data Transfer: Costs apply for data transferred in and out of AWS.

A free trial is available, allowing you to experiment with DocumentDB with no upfront costs.

8. Conclusion

Amazon DocumentDB (with MongoDB compatibility) is engineered for modern, scalable applications that require a flexible, JSON-based document database. Its architecture—with decoupled compute and storage, high availability through multi-AZ replication, and seamless scaling—combined with robust security and compliance features makes it an ideal choice for mission-critical workloads. By using the same MongoDB APIs, developers can migrate existing applications with minimal changes while benefiting from the full managed service experience provided by AWS.

For more information, refer to the official documentation.